#pragma once
#include<stdio.h>
#define heapSize 128
typedef int DataType;
typedef struct {
	DataType data[heapSize];
	int n;
}maxHeap;

void siftDown(maxHeap& H, int start, int m)
{
	if (start == m)
	{
		return;
	}
	int i = start;
	int j = 2 * i + 1;
	DataType temp = H.data[i];
	while (j <= m)
	{
		if ( j<m &&H.data[j] < H.data[j + 1])
		{
			j++;
		}
		if (temp >= H.data[j])
		{
			break;
		}
		else
		{
			H.data[i] = H.data[j];
			i = j;
			j = 2 * j + 1;
		}
	}
	H.data[i] = temp;
}